package me.magicall.myblog.admin.web.springmvc.controllers;

import me.magicall.myblog.util.UrlPatternRule;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

@RequestMapping(method = RequestMethod.GET, //
value = /* "/admin" + */UrlPatternRule.MODEL_NAME + "/add")
@Controller("addController")
public class AddController {

	@RequestMapping
	public String add(final ModelMap modelMap,//
			@PathVariable("modelName") final String modelName) {
		return UrlBasedViewResolver.REDIRECT_URL_PREFIX + "/" + modelName + "/edit";
	}
}
